mirror your GitHub repos to tangled.org automatically
1

Configure Feed

Select the types of activity you want to include in your feed.

at main 930 B View raw
1import { and, eq } from 'drizzle-orm' 2import { repoMapping } from '#server/db/schema' 3import { useDb } from '#server/utils/db' 4import { requireSessionAndMappingId } from '#server/utils/repo-route' 5 6/** 7 * Pause sync for one mapping. The worker checks `disabledAt` on every push 8 * and skips disabled rows; we leave `status` alone so re-enabling restores 9 * the prior state. 10 */ 11export default defineEventHandler(async event => { 12 const { session, mappingId } = await requireSessionAndMappingId(event) 13 14 const db = useDb() 15 const updated = await db.update(repoMapping) 16 .set({ disabledAt: new Date(), updatedAt: new Date() }) 17 .where(and( 18 eq(repoMapping.id, mappingId), 19 eq(repoMapping.installationId, session.installationId), 20 )) 21 .returning({ id: repoMapping.id }) 22 if (updated.length === 0) { 23 throw createError({ statusCode: 404, statusMessage: 'mapping not found' }) 24 } 25 return { ok: true } 26})